<?php require '../public/system/headers/headers.php';?>
<?php echo $this->headLink()->appendStylesheet($this->websiteUrl . 'system/css/seotoaster.css'); ?>
<?php echo $this->headScript()->appendFile($this->websiteUrl . 'system/js/jquery/jquery.js'); ?>
<?php echo $this->headScript()->appendFile($this->websiteUrl . 'system/js/jquery/plugins/newDOMElement.jquery.js'); ?>
<script type="text/javascript">
function subzone(zone){
    switch (zone) {
        case "EU":
            var list = [
                 '<p><input type="checkbox" name="AT" />Austria</p>',
                 '<p><input type="checkbox" name="BE" />Belgium</p>',
                 '<p><input type="checkbox" name="BG" />Bulgaria</p>',
                 '<p><input type="checkbox" name="CY" />Cyprus</p>',
                 '<p><input type="checkbox" name="CZ" />Czech Republic</p>',
                 '<p><input type="checkbox" name="DK" />Denmark</p>',
                 '<p><input type="checkbox" name="EE" />Estonia</p>',
                 '<p><input type="checkbox" name="FI" />Finland</p>',
                 '<p><input type="checkbox" name="FR" />France</p>',
                 '<p><input type="checkbox" name="DE" />Germany</p>',
                 '<p><input type="checkbox" name="GR" />Greece</p>',
                 '<p><input type="checkbox" name="HU" />Hungary</p>',
                 '<p><input type="checkbox" name="IE" />Ireland</p>',
                 '<p><input type="checkbox" name="IT" />Italy</p>',
                 '<p><input type="checkbox" name="LV" />Latvia</p>',
                 '<p><input type="checkbox" name="LT" />Lithuania</p>',
                 '<p><input type="checkbox" name="LU" />Luxembourg</p>',
                 '<p><input type="checkbox" name="MT" />Malta</p>',
                 '<p><input type="checkbox" name="NL" />Netherlands</p>',
                 '<p><input type="checkbox" name="PL" />Poland</p>',
                 '<p><input type="checkbox" name="PT" />Portugal</p>',
                 '<p><input type="checkbox" name="RO" />Romania</p>',
                 '<p><input type="checkbox" name="SK" />Slovakia</p>',
                 '<p><input type="checkbox" name="SI" />Slovenia</p>',
                 '<p><input type="checkbox" name="ES" />Spain</p>',
                 '<p><input type="checkbox" name="SE" />Sweden</p>',
                 '<p><input type="checkbox" name="GB" />United Kingdom</p>'
            ]

            break
        case "US":
            var list = [
                '<p><input type="checkbox" name="AK" />Alaska</p>',
                '<p><input type="checkbox" name="AL" />Alabama</p>',
                '<p><input type="checkbox" name="AR" />Arkansas</p>',
                '<p><input type="checkbox" name="AZ" />Arizona</p>',
                '<p><input type="checkbox" name="CA" />California</p>',
                '<p><input type="checkbox" name="CO" />Colorado</p>',
                '<p><input type="checkbox" name="CT" />Connecticut</p>',
                '<p><input type="checkbox" name="DC" />Washington D.C.</p>',
                '<p><input type="checkbox" name="DE" />Delaware</p>',
                '<p><input type="checkbox" name="FL" />Florida</p>',
                '<p><input type="checkbox" name="GA" />Georgia</p>',
                '<p><input type="checkbox" name="HI" />Hawaii</p>',
                '<p><input type="checkbox" name="IA" />Iowa</p>',
                '<p><input type="checkbox" name="ID" />Idaho</p>',
                '<p><input type="checkbox" name="IL" />Illinois</p>',
                '<p><input type="checkbox" name="IN" />Indiana</p>',
                '<p><input type="checkbox" name="KS" />Kansas</p>',
                '<p><input type="checkbox" name="KY" />Kentucky</p>',
                '<p><input type="checkbox" name="LA" />Louisiana</p>',
                '<p><input type="checkbox" name="MA" />Massachusetts</p>',
                '<p><input type="checkbox" name="MD" />Maryland</p>',
                '<p><input type="checkbox" name="ME" />Maine</p>',
                '<p><input type="checkbox" name="MI" />Michigan</p>',
                '<p><input type="checkbox" name="MN" />Minnesota</p>',
                '<p><input type="checkbox" name="MO" />Mississippi</p>',
                '<p><input type="checkbox" name="MS" />Missouri</p>',
                '<p><input type="checkbox" name="MT" />Montana</p>',
                '<p><input type="checkbox" name="NC" />North Carolina</p>',
                '<p><input type="checkbox" name="ND" />North Dakota</p>',
                '<p><input type="checkbox" name="NE" />Nebraska</p>',
                '<p><input type="checkbox" name="NH" />New Hampshire</p>',
                '<p><input type="checkbox" name="NJ" />New Jersey</p>',
                '<p><input type="checkbox" name="NM" />New Mexico</p>',
                '<p><input type="checkbox" name="NV" />Nevada</p>',
                '<p><input type="checkbox" name="NY" />New York</p>',
                '<p><input type="checkbox" name="OH" />Ohio</p>',
                '<p><input type="checkbox" name="OK" />Oklahoma</p>',
                '<p><input type="checkbox" name="OR" />Oregon</p>',
                '<p><input type="checkbox" name="PA" />Pennsylvania</p>',
                '<p><input type="checkbox" name="RI" />Rhode Island</p>',
                '<p><input type="checkbox" name="SC" />South Carolina</p>',
                '<p><input type="checkbox" name="SD" />South Dakota</p>',
                '<p><input type="checkbox" name="TN" />Tennessee</p>',
                '<p><input type="checkbox" name="TX" />Texas</p>',
                '<p><input type="checkbox" name="UT" />Utah</p>',
                '<p><input type="checkbox" name="VA" />Virginia</p>',
                '<p><input type="checkbox" name="VT" />Vermont</p>',
                '<p><input type="checkbox" name="WA" />Washington</p>',
                '<p><input type="checkbox" name="WI" />Wisconsin</p>',
                '<p><input type="checkbox" name="WV" />West Virginia</p>',
                '<p><input type="checkbox" name="WY" />Wyoming</p>'
            ]
            break
        case 'CA':
            var list = [
                '<p><input type="checkbox" name="Alberta" />Alberta</p>',
                '<p><input type="checkbox" name="British Columbia" />British Columbia</p>',
                '<p><input type="checkbox" name="Manitoba" />Manitoba</p>',
                '<p><input type="checkbox" name="New Brunswick" />New Brunswick</p>',
                '<p><input type="checkbox" name="Newfoundland" />Newfoundland</p>',
                '<p><input type="checkbox" name="Northwest Territories" />Northwest Territories</p>',
                '<p><input type="checkbox" name="Nova Scotia" />Nova Scotia</p>',
                '<p><input type="checkbox" name="Nunavut" />Nunavut</p>',
                '<p><input type="checkbox" name="Ontario" />Ontario</p>',
                '<p><input type="checkbox" name="Prince Edward Island" />Prince Edward Island</p>',
                '<p><input type="checkbox" name="Quebec" />Quebec</p>',
                '<p><input type="checkbox" name="Saskatchewan" />Saskatchewan</p>',
                '<p><input type="checkbox" name="Yukon Territory" />Yukon Territory</p>'
                ]
            break
        case 'other':
            var list = [
                '<p><input type="checkbox" name="AL" />Albania</p>',
                '<p><input type="checkbox" name="DZ" />Algeria</p>',
                '<p><input type="checkbox" name="AD" />Andorra</p>',
                '<p><input type="checkbox" name="AO" />Angola</p>',
                '<p><input type="checkbox" name="AI" />Anguilla</p>',
                '<p><input type="checkbox" name="AG" />Antigua and Barbuda</p>',
                '<p><input type="checkbox" name="AR" />Argentina</p>',
                '<p><input type="checkbox" name="AM" />Armenia</p>',
                '<p><input type="checkbox" name="AW" />Aruba</p>',
                '<p><input type="checkbox" name="AU" />Australia</p>',
                '<p><input type="checkbox" name="AZ" />Azerbaijan Republic</p>',
                '<p><input type="checkbox" name="BS" />Bahamas</p>',
                '<p><input type="checkbox" name="BH" />Bahrain</p>',
                '<p><input type="checkbox" name="BB" />Barbados</p>',
                '<p><input type="checkbox" name="BZ" />Belize</p>',
                '<p><input type="checkbox" name="BJ" />Benin</p>',
                '<p><input type="checkbox" name="BM" />Bermuda</p>',
                '<p><input type="checkbox" name="BT" />Bhutan</p>',
                '<p><input type="checkbox" name="BO" />Bolivia</p>',
                '<p><input type="checkbox" name="BA" />Bosnia and Herzegovina</p>',
                '<p><input type="checkbox" name="BW" />Botswana</p>',
                '<p><input type="checkbox" name="BR" />Brazil</p>',
                '<p><input type="checkbox" name="VG" />British Virgin Islands</p>',
                '<p><input type="checkbox" name="BN" />Brunei</p>',
                '<p><input type="checkbox" name="BF" />Burkina Faso</p>',
                '<p><input type="checkbox" name="BI" />Burundi</p>',
                '<p><input type="checkbox" name="KH" />Cambodia</p>',
                //'<p><input type="checkbox" name="CA" />Canada</p>',
                '<p><input type="checkbox" name="CV" />Cape Verde</p>',
                '<p><input type="checkbox" name="KY" />Cayman Islands</p>',
                '<p><input type="checkbox" name="TD" />Chad</p>',
                '<p><input type="checkbox" name="CL" />Chile</p>',
                '<p><input type="checkbox" name="CN" />China</p>',
                '<p><input type="checkbox" name="CO" />Colombia</p>',
                '<p><input type="checkbox" name="KM" />Comoros</p>',
                '<p><input type="checkbox" name="CK" />Cook Islands</p>',
                '<p><input type="checkbox" name="CR" />Costa Rica</p>',
                '<p><input type="checkbox" name="HR" />Croatia</p>',
                '<p><input type="checkbox" name="CD" />Democratic Republic of the Congo</p>',
                '<p><input type="checkbox" name="DJ" />Djibouti</p>',
                '<p><input type="checkbox" name="DM" />Dominica</p>',
                '<p><input type="checkbox" name="DO" />Dominican Republic</p>',
                '<p><input type="checkbox" name="EC" />Ecuador</p>',
                '<p><input type="checkbox" name="SV" />El Salvador</p>',
                '<p><input type="checkbox" name="ER" />Eritrea</p>',
                '<p><input type="checkbox" name="ET" />Ethiopia</p>',
                '<p><input type="checkbox" name="FK" />Falkland Islands</p>',
                '<p><input type="checkbox" name="FO" />Faroe Islands</p>',
                '<p><input type="checkbox" name="FM" />Federated States of Micronesia</p>',
                '<p><input type="checkbox" name="FJ" />Fiji</p>',
                '<p><input type="checkbox" name="GF" />French Guiana</p>',
                '<p><input type="checkbox" name="PF" />French Polynesia</p>',
                '<p><input type="checkbox" name="GA" />Gabon Republic</p>',
                '<p><input type="checkbox" name="GM" />Gambia</p>',
                '<p><input type="checkbox" name="GI" />Gibraltar</p>',
                '<p><input type="checkbox" name="GL" />Greenland</p>',
                '<p><input type="checkbox" name="GD" />Grenada</p>',
                '<p><input type="checkbox" name="GP" />Guadeloupe</p>',
                '<p><input type="checkbox" name="GT" />Guatemala</p>',
                '<p><input type="checkbox" name="GN" />Guinea</p>',
                '<p><input type="checkbox" name="GW" />Guinea Bissau</p>',
                '<p><input type="checkbox" name="GY" />Guyana</p>',
                '<p><input type="checkbox" name="HN" />Honduras</p>',
                '<p><input type="checkbox" name="HK" />Hong Kong</p>',
                '<p><input type="checkbox" name="IS" />Iceland</p>',
                '<p><input type="checkbox" name="IN" />India</p>',
                '<p><input type="checkbox" name="ID" />Indonesia</p>',
                '<p><input type="checkbox" name="IL" />Israel</p>',
                '<p><input type="checkbox" name="JM" />Jamaica</p>',
                '<p><input type="checkbox" name="JP" />Japan</p>',
                '<p><input type="checkbox" name="JO" />Jordan</p>',
                '<p><input type="checkbox" name="KZ" />Kazakhstan</p>',
                '<p><input type="checkbox" name="KE" />Kenya</p>',
                '<p><input type="checkbox" name="KI" />Kiribati</p>',
                '<p><input type="checkbox" name="KW" />Kuwait</p>',
                '<p><input type="checkbox" name="KG" />Kyrgyzstan</p>',
                '<p><input type="checkbox" name="LA" />Laos</p>',
                '<p><input type="checkbox" name="LS" />Lesotho</p>',
                '<p><input type="checkbox" name="LI" />Liechtenstein</p>',
                '<p><input type="checkbox" name="MG" />Madagascar</p>',
                '<p><input type="checkbox" name="MW" />Malawi</p>',
                '<p><input type="checkbox" name="MY" />Malaysia</p>',
                '<p><input type="checkbox" name="MV" />Maldives</p>',
                '<p><input type="checkbox" name="ML" />Mali</p>',
                '<p><input type="checkbox" name="MH" />Marshall Islands</p>',
                '<p><input type="checkbox" name="MQ" />Martinique</p>',
                '<p><input type="checkbox" name="MR" />Mauritania</p>',
                '<p><input type="checkbox" name="MU" />Mauritius</p>',
                '<p><input type="checkbox" name="YT" />Mayotte</p>',
                '<p><input type="checkbox" name="MX" />Mexico</p>',
                '<p><input type="checkbox" name="MN" />Mongolia</p>',
                '<p><input type="checkbox" name="MS" />Montserrat</p>',
                '<p><input type="checkbox" name="MA" />Morocco</p>',
                '<p><input type="checkbox" name="MZ" />Mozambique</p>',
                '<p><input type="checkbox" name="NA" />Namibia</p>',
                '<p><input type="checkbox" name="NR" />Nauru</p>',
                '<p><input type="checkbox" name="NP" />Nepal</p>',
                '<p><input type="checkbox" name="AN" />Netherlands Antilles</p>',
                '<p><input type="checkbox" name="NC" />New Caledonia</p>',
                '<p><input type="checkbox" name="NZ" />New Zealand</p>',
                '<p><input type="checkbox" name="NI" />Nicaragua</p>',
                '<p><input type="checkbox" name="NE" />Niger</p>',
                '<p><input type="checkbox" name="NU" />Niue</p>',
                '<p><input type="checkbox" name="NF" />Norfolk Island</p>',
                '<p><input type="checkbox" name="NO" />Norway</p>',
                '<p><input type="checkbox" name="OM" />Oman</p>',
                '<p><input type="checkbox" name="PW" />Palau</p>',
                '<p><input type="checkbox" name="PA" />Panama</p>',
                '<p><input type="checkbox" name="PG" />Papua New Guinea</p>',
                '<p><input type="checkbox" name="PE" />Peru</p>',
                '<p><input type="checkbox" name="PH" />Philippines</p>',
                '<p><input type="checkbox" name="PN" />Pitcairn Islands</p>',
                '<p><input type="checkbox" name="QA" />Qatar</p>',
                '<p><input type="checkbox" name="CG" />Republic of the Congo</p>',
                '<p><input type="checkbox" name="RE" />Reunion</p>',
                '<p><input type="checkbox" name="RU" />Russia</p>',
                '<p><input type="checkbox" name="RW" />Rwanda</p>',
                '<p><input type="checkbox" name="VC" />Saint Vincent and the Grenadines</p>',
                '<p><input type="checkbox" name="WS" />Samoa</p>',
                '<p><input type="checkbox" name="SM" />San Marino</p>',
                '<p><input type="checkbox" name="ST" />São Tomé and Príncipe</p>',
                '<p><input type="checkbox" name="SA" />Saudi Arabia</p>',
                '<p><input type="checkbox" name="SN" />Senegal</p>',
                '<p><input type="checkbox" name="SC" />Seychelles</p>',
                '<p><input type="checkbox" name="SL" />Sierra Leone</p>',
                '<p><input type="checkbox" name="SG" />Singapore</p>',
                '<p><input type="checkbox" name="SB" />Solomon Islands</p>',
                '<p><input type="checkbox" name="SO" />Somalia</p>',
                '<p><input type="checkbox" name="ZA" />South Africa</p>',
                '<p><input type="checkbox" name="KR" />South Korea</p>',
                '<p><input type="checkbox" name="LK" />Sri Lanka</p>',
                '<p><input type="checkbox" name="SH" />St. Helena</p>',
                '<p><input type="checkbox" name="KN" />St. Kitts and Nevis</p>',
                '<p><input type="checkbox" name="LC" />St. Lucia</p>',
                '<p><input type="checkbox" name="PM" />St. Pierre and Miquelon</p>',
                '<p><input type="checkbox" name="SR" />Suriname</p>',
                '<p><input type="checkbox" name="SJ" />Svalbard and Jan Mayen Islands</p>',
                '<p><input type="checkbox" name="SZ" />Swaziland</p>',
                '<p><input type="checkbox" name="CH" />Switzerland</p>',
                '<p><input type="checkbox" name="TW" />Taiwan</p>',
                '<p><input type="checkbox" name="TJ" />Tajikistan</p>',
                '<p><input type="checkbox" name="TZ" />Tanzania</p>',
                '<p><input type="checkbox" name="TH" />Thailand</p>',
                '<p><input type="checkbox" name="TG" />Togo</p>',
                '<p><input type="checkbox" name="TO" />Tonga</p>',
                '<p><input type="checkbox" name="TT" />Trinidad and Tobago</p>',
                '<p><input type="checkbox" name="TN" />Tunisia</p>',
                '<p><input type="checkbox" name="TR" />Turkey</p>',
                '<p><input type="checkbox" name="TM" />Turkmenistan</p>',
                '<p><input type="checkbox" name="TC" />Turks and Caicos Islands</p>',
                '<p><input type="checkbox" name="TV" />Tuvalu</p>',
                '<p><input type="checkbox" name="UG" />Uganda</p>',
                '<p><input type="checkbox" name="UA" />Ukraine</p>',
                '<p><input type="checkbox" name="AE" />United Arab Emirates</p>',
                '<p><input type="checkbox" name="UY" />Uruguay</p>',
                '<p><input type="checkbox" name="VU" />Vanuatu</p>',
                '<p><input type="checkbox" name="VA" />Vatican City State</p>',
                '<p><input type="checkbox" name="VE" />Venezuela</p>',
                '<p><input type="checkbox" name="VN" />Vietnam</p>',
                '<p><input type="checkbox" name="WF" />Wallis and Futuna Islands</p>',
                '<p><input type="checkbox" name="YE" />Yemen</p>',
                '<p><input type="checkbox" name="ZM" />Zambia</p>'
            ]
            break
        default:
            var list = []
            break
    }
    return list.join(' ')
}

$(document).ready(function(){
    
    $('#add-rule').click(function(event){
        //var lastRuleId = $('#taxes').find('fieldset').size()
        if ($('fieldset').size()){
            var arr =[]
            $('fieldset').each(function(){
                var id = $(this).attr('id')
                arr.push(id.replace(/^rule-/g,''))
            })
            var lastRuleId =  ++arr[arr.length-1]
        } else {
            var lastRuleId = 1
        }

        $('#taxes').newDOMElement([{
                tagName : 'fieldset',
                id : 'rule-'+(lastRuleId),
                childNodes : [
                    {tagName: 'input', type:'hidden',name: 'taxrule['+lastRuleId+'][id]',value: ''+lastRuleId+''},
                    //{tagName: 'label', innerHTML : '#'+lastRuleId+' '},
                    {tagName: 'select', name: 'taxrule['+lastRuleId+'][zone]', className: 'zone', childNodes : [
                            {tagName:'option',value:'US',innerHTML:'United States'},
                            {tagName:'option',value:'CA',innerHTML:'Canada'},
                            {tagName:'option',value:'EU',innerHTML:'European Union'},
                            {tagName:'option',value:'other',innerHTML:'Others'},
                            {tagName:'option',value:'pickup',innerHTML:'Pickup'}
                    ]},
                    {tagName: 'input',type: 'text',className: 'subzone',name: 'taxrule['+lastRuleId+'][subzone]'},
                    {tagName: 'div',style:'float:right',childNodes: [
                            {tagName: 'input',type: 'text',name: 'taxrule['+lastRuleId+'][tax][1]',value: '0'},
                            {tagName: 'label',innerHTML:'%'},
                            {tagName: 'input',type: 'text',name: 'taxrule['+lastRuleId+'][tax][2]',value: '0'},
                            {tagName: 'label',innerHTML:'%'},
                            {tagName: 'input',type: 'text',name: 'taxrule['+lastRuleId+'][tax][3]',value: '0'},
                            {tagName: 'label',innerHTML:'%'},
                            {tagName: 'input', type: 'button', className: 'remove-rule', value: 'x'}
                    ]},
                    
                ]
        }]);

        event.preventDefault();
    });

    $('.zone').live('change', function(){
        switch ($(this).val()){
            case 'pickup':
                if ($('option:selected[value=pickup]').size()>1)
                {
                    $(this).find('option').attr('selected',false);
                    return false
                }
                $(this).next('.subzone').hide()
                break;
            default:
                $(this).next('.subzone:hidden').show()
                $(this).next('.subzone').val('click to select')
                break;
        }
        
    });

    $('.subzone').live('click', function(event){
        var content = subzone($(this).parent().find('.zone').val())
        var prechecked = $(this).val().split(',')
        
        $('#subzone-list-form').append(content)
        for (var i=0;i<prechecked.length;i++){
            $('#subzone-list-form').find('input:checkbox[name='+prechecked[i]+']').attr('checked','true')
        }
        $('#subzone-list-form').find('input[name="caller"]').val($(this).parent().attr('id'))
        $('#subzone-list').show()
        content = null
        prechecked = null
        event.preventDefault
    });

    $('input:text[name^=taxrule]').live('change',function(event){
        val = $(this).val()
        if (isNaN(val)) $(this).addClass('er')
        else {
            if ($(this).hasClass('er')) $(this).removeClass('er')
        }
    });

    $('#subzone-list-form').submit(function(event){
        var zones = []
        $(this).find('input:checkbox:checked').each(function(){
            zones.push($(this).attr('name'))
        });
        var caller = $(this).find('input[name="caller"]').val()
        $('#'+caller).find('input[name*=subzone]').val(zones.join(','))
        $(this).parent().hide()
        $(this).find('p').remove()
        event.preventDefault()
    });

    $('form#savetaxes').submit(function(event){
        if ($('.er').size()) {
            ($('.er:first').focus())
            event.preventDefault()
        }
    });

    $('.remove-rule').live('click',function(event){
       $(this).closest('fieldset').remove();
       //event.preventDefault();
    });

    $('option:selected[value=pickup]').parent('select').next('input.subzone').val('')
        .hide()
});
</script>
<div id="seotoaster" class="taxratesconfig">
<div class="admineditwhat">{%Tax configuration rules%} </div>
<div class="close_window" onclick="parent.tb_remove();"></div>
<?php if ($this->error) : ?>
<div id="message" class="errors" style="background-color:red;" onclick="this.style.display='none';">{%Corrupted data detected. Configuration not updated%}.</div>
<?php endif; ?>
<?php if ($this->update) : ?>
<div id="message" class="errors" style="background-color:green;" onclick="this.style.display='none';">{%Configuration updated%}.</div>
<?php endif; ?>
<div id="subzone-list">
    <form name="subzone" id="subzone-list-form">
        <div style="display:block;width:580px; background-color:#fff;padding:5px 0px 0px 0px;position:fixed;margin-top:307px;text-align:right;"
            <input type="submit" class="formsubmit" name="submit"  value="OK" style="position:relative;"/>
            <input type="hidden" name="caller" />
       </div>
    </form>
</div>
<form action="<?php echo $this->websiteUrl; ?>sys/backend_shopping/taxes/" name="savetaxes" id="savetaxes" method="post" enctype="multipart/form-data">
      
        <input type="button" id="add-rule" class="formsubmit" value="+" style="width:60px;margin:0px 25px"/>
   
	
	<div style="position: relative;float:right;margin-right:70px;clear:both"><label>{%Labels%}:</label>
        <input type="text" name="label[1]" id="label1" value="<?php echo $this->labels[1];?>"/> &nbsp; &nbsp; 
        <input type="text" name="label[2]" id="label2" value="<?php echo $this->labels[2];?>"/> &nbsp; &nbsp;&nbsp;
        <input type="text" name="label[3]" id="label3" value="<?php echo $this->labels[3];?>"/>
    </div>
    <div id="taxes">
        <?php foreach ($this->taxrules as $rule) : ?>
        <?php if (!$rule['id']) $rule['id'] = ++$id;?>
        <fieldset id="rule-<?php echo $rule['id']?>">
            <input type="hidden" name="taxrule[<?php echo $rule['id']?>][id]" value="<?php echo $rule['id']?>" />
            <!--label>#<?php echo $rule['id']?></label-->
            <select class="zone" name="taxrule[<?php echo $rule['id']?>][zone]">
                <option value="">select</option>
                <option value="US" <?php echo ($rule['zone']=='US' ? 'selected="true"' : ''); ?>>United States</option>
                <option value="CA" <?php echo ($rule['zone']=='CA' ? 'selected="true"' : ''); ?>>Canada</option>
                <option value="EU" <?php echo ($rule['zone']=='EU' ? 'selected="true"' : ''); ?>>European Union</option>
                <option value="other" <?php echo ($rule['zone']=='other' ? 'selected="true"' : ''); ?>>Others</option>
                <option value="pickup" <?php echo ($rule['zone']=='pickup' ? 'selected="true"' : ''); ?>>Pickup</option>
            </select>

            <input class="subzone" type="text" name="taxrule[<?php echo $rule['id']?>][subzone]" style="" value="<?php echo $rule[subzone]; ?>" />
            <div style="float:right">
                <?php foreach ($rule['tax'] as $key => $value):?>
                    <input type="text" name="taxrule[<?php echo $rule['id']?>][tax][<?php echo $key;?>]" value="<?php echo $value;?>"/><label>%</label>
                <?php endforeach;?>
            <!--input type="text" name="taxrule[<?php echo $rule['id']?>][tax][1]" value="<?php echo $rule['tax'][0];?>"/><label>%</label>
            <input type="text" name="taxrule[<?php echo $rule['id']?>][tax][2]" value="<?php echo $rule['tax'][1];?>"/><label>%</label>
            <input type="text" name="taxrule[<?php echo $rule['id']?>][tax][3]" value="<?php echo $rule['tax'][2];?>"/><label>%</label-->
            <input type="button" name="remove-rule" class="remove-rule" value="x" />
            </div>
            
        </fieldset>
        <?php endforeach; ?>
    </div>

    <div>
        <input type="submit" class="formsubmit" value="{%save%}" />
    </div>
</form>

</div>